<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title></title>
    <c:import url="../../header.jsp"/>
</head>
<body>
<div class="content-warp">
    <div class="dgg-list-top-warp">
        <%-- <form id="searchFormAll" action="${basePath}/all_order/excel_export_all.do">--%>
        <div class="screen-search">
            <ul>
                <li>
                    <label>所属生产事业部：</label>
                    <input type="hidden" id="productOrgIdHidden">
                    <select id="productOrgId" name="productOrgId">
                    </select>
                </li>
                <li>
                    <label>流程人员：</label>
                    <select id="flowUserId" name="flowUserId" style="min-width: 80px; display: none;">
                    </select>
                </li>
                <li>
                    <label>超期日期：</label>
                    <input type="text" readonly class="dggui-input dggui-time-range" id="timeOut" name="timeOut">
                    <i class="iconfont icon-rili"></i>
                </li>
                <li>
                    <button class="dggui-btn searchBtn" onclick="tableReload();return false;">搜索</button>
                    <button class="dggui-btn dggui-btn-primary" onclick="cleanSearch();return false;">清空条件</button>
                    <d:hasUrlAuth authCode="RZSC_OPERATION_EXPORT">
                        <button class="dggui-btn dggui-btn-green"
                                onclick="excelExportAll('${basePath}/rzsc/punish/export_node_timeout_punish.do');return false;">导出
                        </button>
                    </d:hasUrlAuth>
                </li>

            </ul>

        </div>
        <%--</form>--%>

    </div>
    <div class="list-content">
        <div class="table-warp">
            <table class="dggui-table" id="nodeTimeOutPunish">
            </table>
        </div>
    </div>
</div>

<c:import url="/WEB-INF/jsp/footer.jsp"/>
<script>
    var tables;
    dggui.use(['table', 'select2', 'dggdate'], function () {
        var table = dggui.table;
        var select2 = dggui.select2;
        var dggdate = dggui.dggdate;
        //初始化所属生产事业部
        syb("#productOrgId");
        select2.render({
            placeholder: "请选择",
            elem: $('#productOrgId'),
            allowClear: true,
            width: "160px"
        });
        //初始化签单时间
        dggdate.render({
            elem: '#timeOut',
            type: 'date',
            range: '~'
        });
        //初始化流程人员
        initUser("RZSC_FLOW_USER", "role", "#flowUserId");
        select2.render({
            placeholder: "请选择",
            allowClear: true,
            elem: $('#flowUserId'),
            width: "160px"
        });
        var opt = {
            "elem": "#nodeTimeOutPunish",
            "ajax": sysInfo.basePath + "/rzsc/punish/node_timeout_punish.do",
            "scrollX": "true",//是否开启横项滚动
            //"selectCheck": false, //多选,同时选中复选框
            "oneSelectCheck": true,//单选，同时选中复选框
            "fixedColumns": {//锁定列，只有开启scrollX时才生效
                "leftColumns": 4,//左侧锁定2列
                "rightColumns": 1//右侧锁定1列
            },
            "fnServerParams": function (aoData) {
                //搜索条件
                aoData = $.extend(aoData, {
                        productOrgId: $("#productOrgId").val(),
                        flowUserId: $("#flowUserId").val(),
                        timeOut: $("#timeOut").val(),
                    }
                )
                return aoData;
            },
            "aoColumns": [{
                "sClass": "check-th",
                "title": "<input type='checkbox' class='checkall'>",
                "orderable": false,
                "render": function (data, type, full, meta) {
                    return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                }
            },
                {
                    "title": "序号",
                    "orderable": false,
                    "render": function (data, type, full, meta) {
                        return meta.row + 1;
                    }
                },
                {
                    "title": "流程人员",
                    "orderable": false,
                    "data": "flowUserName",
                    "render": function (data, type, full, meta) {
                        return data ? data + '<p>' + emptyStringConvert(full.flowUserOrgName) + '</p>' : '';
                    }
                },
                {
                    "title": "所属生产事业部",
                    "data": "productOrgName",
                    "orderable": false,
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                },
                {
                    "title": "销售订单编号",
                    "orderable": false,
                    "data": "orderNo",
                    "render": function (data, type, full, meta) {
                        return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                        /*return data;*/
                    }
                },
                {
                    "title": "生产订单编号",
                    "orderable": false,
                    "data": "scProductOrderNo",
                    "render": function (data, type, full, meta) {
                        var result = "";
                        result += '<a href="javascript:;"  class="dggui-link" onclick="openOrderInfoDetail(\'' + full.scProductOrderNo + '\',\'' + full.scProductOrderId + '\')" /><span>' + data + '</span></a>';
                        return result;
                    }
                },
                {
                    "title": "超期节点",
                    "orderable": false,
                    "data": "noName",
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                },
                {
                    "title": "超期日期",
                    "orderable": false,
                    "data": "timeOutTime",
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                },
                /*{
                    "title": "扣罚日期",
                    "orderable": false,
                    "data": "punishTime",
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                },*/
                {
                    "title": "扣罚操行分",
                    "orderable": false,
                    "data": "points",
                    "render": function (data, type, full, meta) {
                        return data;
                    }
                },
                {
                    "title": "扣罚金额",
                    "orderable": false,
                    "data": "money",
                    "render": function (data, type, full, meta) {
                        return data;
                    }
                }
            ]
        };
        tables = table.render(opt);
        // 处理dataTable 异常错误信息
        $.fn.dataTable.ext.errMode = 'none';//不抛出异常
        tables.on('error.dt', function (e, settings, techNote, message) {
            //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
            if (checkEmpty(settings.jqXHR.responseJSON.error)) {
                dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);
            }
        });
    });

    //列表刷新
    function tableReload() {
        tables.ajax.reload();
    }

    /**
     * 导出
     * */
    function excelExportAll(url) {
        var obj = new Object();
        obj.productOrgId = $("#productOrgId").val();
        obj.flowUserId = $("#flowUserId").val();
        obj.timeOut = $("#timeOut").val();
        formSubmit(url, obj);
    }

</script>
</body>
</html>